<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>

<script>
    var str=prompt("请你输入字母：AAABBB"); 
    var count=0;
    var counts=0;
    for(var i=0;i<str.length;i++){
        if(str[i].indexOf("a")>=0){
            count=count+1
        }
    }
    for(var i=0;i<str.length;i++){
        if(str[i].indexOf("A")>=0){
            counts=counts+1
        }
    }
    alert("a个数为"+count+"      A个数为"+counts);


</script>
</html>